<extend name="Base/agent"/>
<block name="content">
			<!--主体内容-->
			<div class="admin-main">
				<p class="current-title">佣金信息</p>
				<p class="current-park"><i class="icon icon-index"></i><a href="#" class="current-index">首页</a> 〉〉 客户信息</p>
				<div class="current-condition">
					<input type="text" class="current-username" id="username" placeholder="请输入用户名" value="{$wherestring['nickname']}"/>
					<select class="yorn-broker" id="state">
						<option value="2" <if condition="$status eq 2">selected="selected"</if>>是否分配</option>
						<option value="1" <if condition="$status eq 1">selected="selected"</if>>已分配</option>
						<option value="0" <if condition="$status eq 0">selected="selected"</if>>未分配</option>
					</select><br/>
					<input type="text" name="start_time" value="{:I('start_time')}" class="current-stardate" placeholder="起始时间" id = "start"/>
					<span style = "margin-left:-15px">至</span>
					<input type="text" name="end_time" value="{:I('end_time')}" class="current-stardate" placeholder="结束时间" id = "end"/>
					<input type="button" id="search" value="搜索" class="current-serach"/>
					<input type="reset" id="clear" value="清空" class="current-reset"/>
					<input type="button" id="downexcle" value="导出EXECL" class="current-serach"/>
					<div>
						<span>已分配:<i style = "color:red"><if condition = "empty($ass_money)">0<else/>{$ass_money}</if> </i>元&nbsp&nbsp</span>
						<span>未分配:<i style = "color:red"><if condition = "empty($not_money)">0<else/>{$not_money}</if> </i>元&nbsp&nbsp</span>
					</div>
				</div>
				<!--数据表格-->
				<div class="main-table-data">
					<p class="table-title">
					<if condition="!empty($_GET['uid'])">
						<?php $user = M('Follow')->where('id='.$_GET[uid])->field('nickname')->find();echo $user['nickname'];?>
						的下级
					<else/>
						所有顾客
					</if>
					</p>
					<table class="current-table">
						<tr>
							<th class="">ID</th>
							<th class="">下单者</th>
					        <th class="">分佣者</th>
							<th class="">佣金</th>
							<th class="">佣金状态</th>
							<th class="">说明</th>
							<th class="">分配时间</th>
							<th class="">创建时间</th>
							<th class="">操作</th>
						</tr>
						<foreach name="list" item="vo" key="k" >

						<tr <if condition="$k%2!=0">class="table-bg"<else/>class="table-nobg"</if>>
							<td>{$vo.id}</td>
							<td><?php $order = M('follow')->where('id='.$vo[order_user_id])->find();echo $order['nickname'];?></td>
							<td><?php $commission = M('follow')->where('id='.$vo[commission_user_id])->find();echo $commission['nickname'];?></td>
							<td>{$vo.commission} </td>
							<td><?php if($vo['status'] == 0){echo "未分配";}else{echo "已分配";}?></td>
							<td>{$vo.note} </td>
							<td>{$vo.update_time|time_format} </td>
							<td>{$vo.create_time|time_format} </td>
							<td><a href="{:U('AgentCustomer/voucher?uid='.$vo[commission_user_id])}">查看下级</a> </td>
						</tr>
						</foreach>
					</table>
					<!--分页-->
					<div class="current-page">
						<!-- <a href="#" class="first">首页</a>
						<a href="#" class="pre"><</a>
						<a href="#">1</a>
						<a href="#" class="currPage">2</a>
						<a href="#" class="pageNo">3</a>
						...
						<a href="#">10</a>
						<a href="#" class="next">></a>
						<a href="#" class="last">尾页</a> -->
						{$_page}
					</div>
				</div>
				
			</div>

		</div>
	</body>
	<script src="__PUBLIC__/Futures/agent/js/datepicker/js/jquery-1.8.3.js"></script>
	<script src="__PUBLIC__/Futures/agent/js/datepicker/js/jquery.ui.core.js"></script>
	<script src="__PUBLIC__/Futures/agent/js/datepicker/js/jquery.ui.widget.js"></script>
	<script src="__PUBLIC__/Futures/agent/js/datepicker/js/jquery.ui.datepicker.js"></script>
	<script type="text/javascript">
		$(function(){
			function myfunc(){
				var string="";
				var username=$("#username").val();
				if(username){
					string="&username="+username;
				}
				var state=$("#state").val();
				if(state!==''){
					string+="&state="+state;
				}
				var start=$("#start").val();
				if(start!=""){
					string+="&start_time="+start;
				}
				var end=$("#end").val();
				if(end!=""){
					string+="&end_time="+end;
				}
				return string;
			}
			$("#downexcle").click(function(){
				var string=myfunc();
				window.location.href="{:U('AgentCustomer/downexecl')}"+string;
			})

			$("#clear").click(function(){
				window.location.href="{:U('AgentCustomer/voucher')}&state=2";
			})

			$("#search").click(function(){
				var string=myfunc();
				window.location.href="{:U(AgentCustomer/voucher)}"+string;
			})
		})
	</script>
</block>
